
import { request } from '../utils/request.js'
import { getCookie } from '../utils/token.js'
// 账号和密码登录
export const loginUsePhoneAndPassword = (phone, pwd) => request({
    url: `/login/cellphone?phone=${phone}&password=${pwd}`,
    methods: 'GET'
})

// 获取登录状态
export const getLoginStatus = () => request({
    url: '/login/status',
    methods: 'GET'
})

// 退出登录
export const logout = () => request({
    url: `/logout`,
    methods: 'GET'
})

// 获取验证码
export const sendCaptcha = (phone) => request({
    url: `/captcha/sent?phone=${phone}`,
    methods: 'GET'
})


// 校验验证码
export const verifyCode = (phone, captcha) => request({
    url: `/captcha/verify?phone=${phone}&captcha=${captcha}`,
    methods: 'GET'
})

// 验证码登录
export const loginUseCaptcha = (phone, captcha) => request({
    url: `/login/cellphone?phone=${phone}&captcha=${captcha}`,
    methods: 'GET'
})


// 获取banner数据 type是类型参数
export const getBanner = (type = 2) => request({
    url: `/banner?type=${type}`,
    methods: 'GET'
})


// 获取热搜列表对搜索框进行更新
export const getHotDetailList = () => request({
    url: 'search/hot/detail',
    methods: 'GET'
})

// 获取homepage信息,哈哈哈我没有使用
export const getHomePageList = () => request({
    url: '/homepage/dragon/ball',
    methods: 'GET'
})

// 推荐数据
export const getTopList = () => request({
    url: '/toplist/detail',
    methods: 'GET'
})


// 根据id获取榜单数据
export const getPlayList = (id) => request({
    url: `/playlist/detail?id=${id}&timestamp=${Date.now()}`,
    methods: 'GET'
})




export const songDetail = (id) => request({
    url: `/song/detail?ids=${id}&cookie=${getCookie()}`,
    methods: 'GET'

})

export const songUrl = (id) => request({
    url: `/song/url?id=${id}&cookie=${getCookie()}`,
    methods: 'GET'

})

export const songLyric = (id) => request({
    url: `/lyric?id=${id}&cookie=${getCookie()}`,
    methods: 'GET'

})

export const songSimi = (id) => request({
    url: `/simi/song?id=${id}`,
    methods: 'GET'
})

export const songComment = (id) => request({
    url: `/comment/music?id=${id}&cookie=${getCookie()}`,
    methods: 'GET'
})


// 获取搜索热词
export const searchHot = () => request({
    url: `/search/hot/detail`,
    methods: 'GET'
})


// 搜索提示
export const searchSuggest = (keywords) => request({
    url: `/search/suggest?keywords=${keywords}&type=mobile`,
    methods: 'GET'
})

//搜索
export const searchWord = (keywords) => request({
    url: `/search?keywords=${keywords}`,
    methods: 'GET'
})

// 获取推荐mv
export const mvRecommend = (limit = 10) => request({
    url: `/mv/first?limit=${limit}`,
    methods: 'GET'
})

// 获取mv地址
export const mvURL = (id) => request({
    url: `/mv/url?id=${id}`,
    methods: 'GET'
})

export const mvList = (limit = 10) => request({
    url: `/mv/exclusive/rcmd?limit=${limit}`,
    methods: 'GET'
})


export const getEveryDayRecommend = () => request({
    url: `/recommend/songs?cookie=${getCookie()}`,
    methods: 'GET'
})


//获取用户信息
export const getUserProfile = (userId) => request({
    url: `/user/detail?uid=${userId}&cookie=${getCookie()}`,
    methods: 'GET'
})

// export const getRectPlayMusic = () => request({
//     url: `/user/record?uid=${uni.getStorageSync('userId')}&type=1&cookie=${getCookie()}`,
//     methods: 'GET',
// })


export const getRcentMusic = () => request({
    url: '/record/recent/song',
    methods: 'GET'
})



// 获取用户歌单
export const singSong = (uid) => request({
    url: `/user/playlist?uid=${uid}`,
    methods: 'GET'
})


// 获取歌单详情
export const songSheet = (id) => request({
    url: `/playlist/detail?id=${id}`,
    methods: 'GET'
})


// 获取推荐歌单,默认取出8个
export const recommendSongSheet = () => request({
    url: `/personalized?limit=15`,
    methods: 'GET'
})




